package com.zfh;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@WebFilter("/test")
public class TestFilter01 implements Filter{

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		System.out.println("这是过滤器的准备部分==============================================");
		
		// 下面，将创建session
		HttpServletRequest req = (HttpServletRequest)request;
		HttpSession session = req.getSession();
		
		chain.doFilter(request, response);
		System.out.println("这是过滤器的善后部分==============================================");
		
	}

}
